keep under one's hat
Preserve the secrecy of something, as in
I'll tell you about it if you promise to keep it under your hat
. This usage alludes to hiding a secret in one's head, covered by a hat.
[
Late 1800s
]